package lcr;

public class Test0023 {
}

class Solution0023_2 {
    public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
        ListNode node1=headA,node2=headB;
        while (node1!=node2){
            node1=node1==null?headB:node1.next;
            node2=node2==null?headA:node2.next;
        }
        return node1;
    }
}
